<?php
    header("content-type:text/html;charset=utf-8");
    $data = $_GET;
    $pageStart = ($data['limit'] * ($data['page']-1));
    $pageEnd = ($data['limit'] * ($data['page']-1))+$data['limit'];
    $connect = mysqli_connect('localhost','root','root','db_info');
    $query = mysqli_query($connect,"select * from tb_submit where 1 limit $pageStart,$pageEnd");
    $list = array();
    while($result = mysqli_fetch_assoc($query)){
        $list[] = $result;
    }

    $allQuery = mysqli_query($connect,"select * from tb_article");

    $list2 = array();
    while($result = mysqli_fetch_assoc($allQuery)){
        $list2[] = $result;
    }


?>

{
  "code": 0,
  "msg": "",
  "count": <?php echo count($list2) ?>,
  "data": [
    <?php
        for($i = 0;$i < count($list)-1;$i++){
    ?>
    {
      "sub_id": <?php echo $list[$i]['sub_id']?>,
      "email": "<?php echo $list[$i]['email']?>",
      "sub_time": "<?php echo $list[$i]['sub_time']?>"
    },
<?php
    }
?>
    {
    "sub_id": <?php echo $list[$i]['sub_id']?>,
    "email": "<?php echo $list[$i]['email']?>",
    "sub_time": "<?php echo $list[$i]['sub_time']?>"
    }
  ]
}